home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Source Sea20778672001.psc / clsParentFile.cls < prev    next >
Encoding:
Visual Basic class definition  |  2001-04-22  |  1.9 KB  |  104 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsParentFile"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. 'The collection of it's children
  17. Private m_colChildFiles As Collection
  18. 'The path of the file
  19. Dim m_strPath As String
  20. '
  21.  
  22. Public Property Get Path() As String
  23.  
  24.   Path = m_strPath
  25.  
  26. End Property
  27.  
  28. Public Property Let Path(v_strPath As String)
  29.  
  30.   m_strPath = v_strPath
  31.  
  32. End Property
  33.  
  34. Public Property Get Count() As Long
  35.  
  36.   Count = m_colChildFiles.Count
  37.  
  38. End Property
  39.  
  40. Public Function Add(ByVal v_strPath As String) As Boolean
  41.   
  42.   Dim objChildFiles As New clsChildFile
  43.   Dim x As Integer
  44.   
  45.   On Error Resume Next
  46.   
  47.   objChildFiles.Path = v_strPath
  48.   
  49.   If m_colChildFiles.Count > 0 Then
  50.     For x = 1 To m_colChildFiles.Count
  51.       If Item(x).Path = v_strPath Then Exit Function
  52.     Next x
  53.   End If
  54.     
  55.   m_colChildFiles.Add objChildFiles, v_strPath
  56.   
  57.   If Err.Number <> 0 Then
  58.     Add = False
  59.   Else
  60.     Add = True
  61.   End If
  62.   
  63.   Set objChildFiles = Nothing
  64.  
  65. End Function
  66.  
  67. Public Sub Clear()
  68.  
  69.   Dim x As Integer
  70.   
  71.   For x = m_colChildFiles.Count To 1 Step -1
  72.     m_colChildFiles.Remove x
  73.   Next x
  74.   
  75. End Sub
  76.  
  77. Public Function Remove(ByVal v_vntIndex As Variant)
  78.  
  79.   On Error Resume Next
  80.   m_colChildFiles.Remove v_vntIndex
  81.   
  82. End Function
  83.  
  84. Public Function Item(ByVal v_vntIndex As Variant) As clsChildFile
  85.  
  86.   On Error Resume Next
  87.   Set Item = m_colChildFiles.Item(v_vntIndex)
  88.   If Err.Number <> 0 Then
  89.     Set Item = Nothing
  90.   End If
  91.   
  92. End Function
  93.  
  94. Private Sub Class_Initialize()
  95.  
  96.   Set m_colChildFiles = New Collection
  97.   
  98. End Sub
  99.  
  100.  
  101.  
  102.  
  103.  
  104.